@extends('home.parent')
@section('title','实名审核列表')
@section('head_js')
@endsection
@section('head_css')
<link rel="stylesheet" href="{{ asset('/css/dataTables.bootstrap.css') }}">
<link rel="stylesheet" href="{{ asset('/css/toggleButtonsMain.css') }}">
@endsection
@section('content')
<div class="content-wrapper">
    <section class="content-header">
        <h1>
            实名审核列表
			<small></small>
        </h1>
        <ol class="breadcrumb">
            <li>
                <a href="{{URL('admin')}}">
                    <i class="fa fa-dashboard"></i>首页
                </a>
            </li>
            <li class="active">实名审核列表</li>
        </ol>
    </section>
    <style>
        table.dataTable thead > tr > th{
            padding-right: 5px;
        }
    </style>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <div class="form-inline pull-right">
                            <fieldset>
                                <div class="input-group input-group-sm">
                                    <span class="input-group-addon">
                                        <strong>公司</strong>
                                    </span>
                                    <input type="text" class="form-control" id="search_company">
                                </div>

                                <div class="input-group input-group-sm">
                                    <span class="input-group-addon">
                                        <strong>用户名</strong>
                                    </span>
                                    <input type="text" class="form-control" id="search_name">
                                </div>
                                <div class="input-group input-group-sm">
                                    <span class="input-group-addon">
                                        <strong>审核状态</strong>
                                    </span>
                                    <select class="form-control" id="search_status" style="width:150px;">
                                        <option value="99">全部</option>
                                        <option value="0">未审核</option>
                                        <option value="1">审核中</option>
                                        <option value="2">实名通过</option>
                                        <option value="-1">实名失败</option>
                                    </select>
                                </div>
                                <div class="input-group input-group-sm">
                                    <div class="input-group-btn">
                                        <button type="button" class="btn btn-primary" onclick="searchData()">
                                            <i class="fa fa-search"></i>
                                        </button>
                                    </div>
                                </div>
                            </fieldset>
                        </div>
                    </div>
                    <!--/.box-header-->
                    <div class="box-body">
                        <table id="data_list" class="table table-bordered table-striped">
                            <thead>
                                <tr>
                                    <th>营业执照</th>
                                    <th>身份证正面</th>
                                    <th>身份证背面</th>
                                    <th>用户</th>
                                    <th>公司名字</th>
                                    <th>类型</th>
                                    <th>联系人昵称</th>
                                    <th>性别</th>
                                    <th>备注</th>
                                    <th>操作者</th>
                                    <th>状态</th>
                                    <th>上传时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                            </tbody>
                            <tfoot>
                                <tr>
                                    <th>营业执照</th>
                                    <th>身份证正面</th>
                                    <th>身份证背面</th>
                                    <th>用户</th>
                                    <th>公司名字</th>
                                    <th>类型</th>
                                    <th>联系人姓名</th>
                                    <th>性别</th>
                                    <th>备注</th>
                                    <th>操作者</th>
                                    <th>状态</th>
                                    <th>上传时间</th>
                                    <th>操作</th>
                                </tr>
                            </tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<div class="modal fade" id="modal-info">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
				<span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title">原因</h4>
			</div>
			<div class="modal-body">
				<div class="form-group">
					<label class="">具体说明</label>
					<input type="text" class="form-control" name="remark" id="remark" placeholder="具体说明">
					<input type="hidden" name="kid" id="kid">
					<input type="hidden" name="status" id="status">
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
				<button type="submit" class="btn btn-primary" onclick="saveData()">确认</button>
			</div>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>
<div id="show" style="position:fixed;width:100%;height:100%;top:0;left:0;right:0;bottom:0;z-index:9998;display:none;">
	<div style="background-color:#000; opacity:0.5; filter:alpha(opacity=50);top:0;left:0;right:0;bottom:0;width:100%;height:100%;"></div>
	<span style="z-index:9999;background-color:#fff;padding:20px;left:45%;top:40%;position:absolute;"><img src="/images/loading.gif"> 上传中.....请耐心等待</span>
</div>
@endsection
@section('foot_js')
<script src="{{ asset('/js/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('/js/dataTables.bootstrap.min.js') }}"></script>
<script src="{{ asset('/js/jquery.slimscroll.min.js') }}"></script>
<script src="{{ asset('/js/fastclick.js') }}"></script>
<script src="{{ asset('/js/tools.js') }}"></script>
<script>
var list_ajax;
$(function() {
    var lang = puppet.langShow();
    list_ajax = $("#data_list").dataTable({
        language: lang,
        autoWidth: false,
        stripeClasses: ["odd", "even"],
        processing: true,
        serverSide: true,
        searching: false,
        orderMulti: false,
        order: [[0, 'desc']],
        renderer: "bootstrap",
        pagingType: "simple_numbers",
        aLengthMenu: [5,10, 20, 50, 100],
        iDisplayLength: 5,
        columnDefs: [{
            "targets": [1, 2, 3, 4,5,6,7,8,9],
            "orderable": false
        },
        ],
        ajax: function(data, callback, settings) {
            var param = {};
            param.limit = data.length;
            param.start = data.start;
            param.page = (data.start / data.length) + 1;
            param.order = data.order;
            param.company = $.trim($("#search_company").val());
            param.search_name = $.trim($("#search_name").val());
            param.search_talk = $.trim($("#search_talk").val());
            param.search_status = $.trim($("#search_status").val());
            $.ajax({
                type: "POST",
                url: "{{ URL('admin/real/index/ajax') }}",
                cache: false,
                data: param,
                dataType: "json",
                success: function(result) {
                    var returnData = {};
                    returnData.draw = data.draw;
                    returnData.recordsTotal = result.total;
                    returnData.recordsFiltered = result.total;
                    returnData.data = result.data;
                    callback(returnData)
                }
            })
        },
        columns: [
			{"data": "Business_license"},
			{"data": "sfz_zm_url"},
			{"data": "sfz_fm_url"},
			{"data": "user_name"},
			{"data": "company"},
            {"data": "customertype"},
			{"data": "name"},
			{"data": "gender"},
            {"data": "remark"},
            {"data": "operator"},
            {"data": "status"},
            {"data": "create_time"},
            {"data": "operation"},
        ],
    }).api()
});
function searchData() {
    $("#data_list").dataTable().fnDraw(false);
    layer.msg("操作成功",{icon:6});
}
//审核操作提交
function saveVoid(kid,status){
	if(status==-1){
		$("#remark").val('');
		$("#kid").val(kid);
		$("#status").val(status);
		$('#modal-info').modal();
	}else{
        layer.confirm('是否确认审核', {
            btn: ['审核通过', '再考虑一下'] //按钮
        }, function () {
			layer.closeAll();
            shenhe(kid, status);
        });
	}
}

function shenhe(kid,status) {
    loading_show();
    $.ajax({
        type:'POST',
        url:"{{URL('real/list/save')}}",
        data:{kid:kid,status:status},
        dataType:'json',
        async:true,
        success:function(r){
            loading_hidden();
            if(r.code==1){
                layer.msg(r.msg,{icon:5,time:1000});
            }else{
                layer.msg(r.msg,{icon:6});
                searchData();
            }
        },
        error:function(){
            loading_hidden();
            layer.msg("网络错误",{icon:5});
        }
    });
}
//添加备注提交
function saveData(){
	var kid=$('#kid').val();
	var status=$('#status').val();
	var remark=$('#remark').val();
	if(remark==''){
		layer.msg("请输入具体说明",{icon:5});
		return false;
	}
	var url = "{{URL('real/list/save')}}";
	var data={kid:kid,status:status,remark:remark};
	var result = puppet.myajax('post',url,data,false);
	if(result.code == 1){
		layer.msg(result.msg,{icon:5});
		return false;
	}else{
        layer.msg(result.msg,{icon:6});
		searchData();
		$('#modal-info').modal('hide');
	}
}
</script>
@endsection